##do-file final##
drop if stratum == 8 | stratum == 9 | missing(stratum)
generate active_care_mom = park_totmin_mom + playing_totmin_mom + reading_totmin_mom
generate active_care_dad = park_totmin_dad + playing_totmin_dad + reading_totmin_dad
generate active_care_difference =  active_care_mom - active_care_dad
generate active_care_combined = active_care_mom + active_care_dad


generate Caribbean = (REGION == 1)
generate Central = (REGION == 2) 
generate Oriental = (REGION == 3) 
generate Pacific = (REGION == 4) 
generate Bogota = (REGION == 5) 
generate San Andres = (REGION == 6) 

generate black_dad = (ethnicity_dad == "5")
generate indigenous_dad = (ethnicity_dad == "1")
generate omin_dad = (ethnicity_dad == "2" | ethnicity_dad == "3" | ethnicity_dad == "4")
generate white_dad = (ethnicity_dad == "6")

generate black_mom = (ethnicity_mom == "5")
generate indigenous_mom = (ethnicity_mom == "1")
generate omin_mom = (ethnicity_mom == "2" | ethnicity_mom == "3" | ethnicity_mom == "4")
generate white_mom = (ethnicity_mom == "6")
generate diffage_couple = age_dad - age_mom
generate wshareactivecare = active_care_mom/active_care_combined
generate couple_type = cond(white_mom == 1 & white_dad == 1, "White", cond((white_mom == 1 & white_dad == 0) | (white_mom == 0 & white_dad == 1), "Mixed", "Minority"))														

generate couple_cstate = cond((civil_mom == 3 & civil_dad == 3), "Married", cond(((civil_mom == 1 & civil_dad == 1) | (civil_mom == 2 & civil_dad == 2)), "Cohabiting",cond((civil_mom == 5 | civil_dad == 5 | civil_mom == 6 | civil_dad == 6), "Single", "Other")))

drop if couple_cstate == "Other"

##think about regressions##

regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1

regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if (white_mom == 1 & white_dad == 0) | (white_mom == 0 & white_dad == 1)

regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if white_mom == 0 & white_dad == 0


regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1

regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if (white_mom == 1 & white_dad == 0) | (white_mom == 0 & white_dad == 1)

regress active_care_difference work_hours_mom work_hours_dad stratum_household totalp_household salary_mom salary_dad male_child education_mom education_dad age_child age_dad age_mom Pacific Oriental Central Caribbean Bogota if white_mom == 0 & white_dad == 0



regress active_care_difference work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1

regress active_care_difference work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if(white_mom == 1 & white_dad == 0) | (white_mom == 0 & white_dad == 1) 

regress active_care_difference work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 0 & white_dad == 0

* Step 2: Create a couple type variable


* Ensure the dataset only includes the categories you're interested in


* Assuming wshareactivecare is your variable of interest
* and you want to exclude "Other" from couple_cstate
egen group = group(couple_cstate couple_type), label

* Create a new variable for the mean of wshareactivecare, by group
egen mean_wshareactivecare = mean(wshareactivecare), by(group)

* Create a new variable for the standard error of wshareactivecare, by group
egen stderr_wshareactivecare = sd(wshareactivecare), by(group)
gen se_wshareactivecare = stderr_wshareactivecare / sqrt(count(wshareactivecare)), by(group)

* Now plot, excluding "Other" from couple_cstate
graph bar mean_wshareactivecare, over(couple_cstate) over(couple_type, relabel(1 "Minority" 2 "Mixed" 3 "White")) asyvars bar(1, color(navy)) ///
blabel(bar, position(outside)) ytitle("Average of wshareactivecare") ///
ylabel(#10) xlabel(none) legend(label(1 "Cohabiting") label(2 "Married") label(3 "Single")) ///
yerror(se_wshareactivecare) title("Average wshareactivecare by Couple State and Type with Error Bars")



* Step 3: Aggregate the data
egen mean_wshare = mean(wshareactivecare), by(couple_type)
egen sd_wshare = sd(wshareactivecare), by(couple_type)
egen count_wshare = count(wshareactivecare), by(couple_type)

* Step 4: Calculate 95% confidence intervals
generate ci95_hi = mean_wshare + (1.96 * (sd_wshare / sqrt(count_wshare)))
generate ci95_lo = mean_wshare - (1.96 * (sd_wshare / sqrt(count_wshare)))

* Step 5: Create the bar chart
graph bar mean_wshare, over(couple_type) || rcap ci95_hi ci95_lo, over(couple_type)

##active care white couples

regress active_care_mom work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1 if white_mom == 0 & white_dad == 0

regress active_care_dad work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1 if white_mom == 0 & white_dad == 0

regress active_care_mom work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom education_mom education_dad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1 if white_mom == 0 & white_dad == 0

generate graduated_hsmom = (education_mom == 4)
generate graduated_hsdad = (education_dad == 4)

generate graduated_collegemom = (education_mom == 10)
generate graduated_collegedad = (education_dad == 10)

regress active_care_mom work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1

regress active_care_dad work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 1 & white_dad == 1

regress active_care_dad work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if(white_mom == 1 & white_dad == 0) | (white_mom == 0 & white_dad == 1) 

regress active_care_dad work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota if white_mom == 0 & white_dad == 0

generate wshareactivecare100 = wshareactivecare*100


feel_fair_mom		feel_fair_dad	

generate workMomGood_mom1 = (workMomGood_mom == 3 | workMomGood_mom == 4)
generate workMomGood_dad1 = (workMomGood_dad == 3 | workMomGood_dad == 4)
generate bothEarn_mom1 = (bothEarn_mom == 3 | bothEarn_mom == 4)
generate bothEarn_dad1 = (workMomGood_dad == 3 | workMomGood_dad == 4)
generate goalMarriageKids_mom1 = (goalMarriageKids_mom == 3 | goalMarriageKids_mom == 4)
generate goalMarriageKids_dad1 = (goalMarriageKids_dad == 3 | goalMarriageKids_dad == 4)
generate womenHomeSkill_mom1 = (womenHomeSkill_mom == 3 | womenHomeSkill_mom == 4)
generate womenHomeSkill_dad1 = (womenHomeSkill_dad == 3 | womenHomeSkill_dad == 4)
generate equalFunRights_mom1 = (equalFunRights_mom == 3 | equalFunRights_mom == 4)
generate equalFunRights_dad1 = (equalFunRights_dad == 3 | equalFunRights_dad == 4)
generate manHeadHousen_mom1 = (manHeadHousen_mom == 3 | manHeadHousen_mom == 4)
generate manHeadHousen_dad1 = (manHeadHousen_dad == 3 | manHeadHousen_dad == 4)

generate feel_timescarce_dad = (feel_time_dad == 3)
generate feel_timescarce_mom = (feel_time_mom == 3)

generate feel_more_dad = (feel_time_dad == 1)
generate feel_more_mom = (feel_time_mom == 1)

regress wshareactivecare100 work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota workMomGood_mom1 workMomGood_dad1 bothEarn_mom1 bothEarn_dad1 goalMarriageKids_mom1 goalMarriageKids_dad1 womenHomeSkill_mom1 womenHomeSkill_dad1 equalFunRights_mom1 equalFunRights_dad1 manHeadHousen_mom1 manHeadHousen_dad1 feel_timescarce_mom feel_timescarce_dad  feel_more_mom feel_more_dad if white_mom == 1 & white_dad == 1

regress wshareactivecare100 workMomGood_mom1 workMomGood_dad1 bothEarn_mom1 bothEarn_dad1 goalMarriageKids_mom1 goalMarriageKids_dad1 womenHomeSkill_mom1 womenHomeSkill_dad1 equalFunRights_mom1 equalFunRights_dad1 manHeadHousen_mom1 manHeadHousen_dad1 feel_timescarce_mom feel_timescarce_dad  feel_more_mom feel_more_dad if white_mom == 0 & white_dad == 0


regress wshareactivecare100 work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom graduated_collegedad stratum_household totalp_household  male_child  age_child Pacific Oriental Central Caribbean Bogota clean_totmin_mom clean_totmin_dad wash_totmin_mom wash_totmin_dad cook_totmin_mom cook_totmin_dad white_mom white_dad married cohabiting

generate married = (civil_mom == 3 & civil_dad == 3)
generate cohabiting = ((civil_mom == 1 & civil_dad == 1) | (civil_mom == 2 & civil_dad == 2))

regress wshareactivecare100 work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom white_mom white_dad chores_mom chores_dad graduated_collegedad stratum_household totalp_household  male_child  age_child married cohabiting Pacific Oriental Central Caribbean Bogota

regress  work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom white_mom white_dad chores_mom chores_dad graduated_collegedad stratum_household totalp_household  male_child  age_child married cohabiting Pacific Oriental Central Caribbean Bogota

regress wshareactivecare100 work_hours_mom work_hours_dad salary_mom salary_dad age_dad age_mom graduated_hsmom graduated_hsdad graduated_collegemom white_mom graduated_collegedad white_dad chores_mom chores_dad married cohabiting stratum_household totalp_household male_child  age_child Pacific Oriental Central Caribbean Bogota

generate chores_mom = clean_totmin_mom + wash_totmin_mom + cook_totmin_mom
generate chores_dad = clean_totmin_dad + wash_totmin_dad + cook_totmin_dad

active_care_mom
active_care_dad
wshareactivecare100 

tabstat active_care_mom, stats(n mean median min max)


work_hours_mom work_hours_dad salary_mom salary_dad
